//
//  ZYCProfileUserInfoFooterView.m
//  ZDSC
//
//  Created by ZDTX on 2021/7/20.
//

#import "ZYCProfileUserInfoFooterView.h"

@interface ZYCProfileUserInfoFooterView ()

//完善功能资料
@property (nonatomic, strong)UIButton *consummateButton;
@end
@implementation ZYCProfileUserInfoFooterView

#pragma mark - init
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self addSubview:self.consummateButton];
        [self.consummateButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(76.0f);
            make.left.equalTo(self).offset(68.0f);
            make.right.equalTo(self).offset(-68.0f);
            make.height.mas_equalTo(40.0f);
        }];
    }
    return self;
}

#pragma mark - setters
- (void)setTitleString:(NSString *)titleString{
    _titleString = titleString;
    [_consummateButton setTitle:titleString forState:UIControlStateNormal];
}
#pragma mark - getters
- (UIButton *)consummateButton {
    if (!_consummateButton) {
        _consummateButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _consummateButton.frame = CGRectMake(0,0, kScreenWidth - 2 * 32, 48);
//        [_consummateButton setTitle:@"完善更多资料" forState:UIControlStateNormal];
        [_consummateButton setTitleColor:HEX_RGB(kTitleWhiteColor) forState:UIControlStateNormal];
        _consummateButton.titleLabel.font = kCustomFont(@"PingFangSC-Light", 18.0f);
        [_consummateButton addTarget:self action:@selector(clickConsummateAction:) forControlEvents:UIControlEventTouchUpInside];
        _consummateButton.layer.cornerRadius = 20;
        _consummateButton.layer.masksToBounds = YES;
        CAGradientLayer *gradientLayer = [CAGradientLayer layer];
        gradientLayer.startPoint = CGPointMake(0, 0);
        gradientLayer.endPoint = CGPointMake(1, 0);
        gradientLayer.colors = @[(__bridge id)HEX_RGB(@"#F6EEB0").CGColor,
                                 (__bridge id)HEX_RGB(@"#009B4C").CGColor];
        gradientLayer.locations = @[@(0.3),@(1.0f)];
        gradientLayer.frame = _consummateButton.bounds;
        gradientLayer.cornerRadius = 20;
        [_consummateButton.layer insertSublayer:gradientLayer atIndex:0];
    }
    return _consummateButton;
}

#pragma mark - action
- (void)clickConsummateAction:(UIButton *)sender{
    if ([self.delegate respondsToSelector:@selector(profileUserInfoFooterViewDidMore)]) {
        [self.delegate profileUserInfoFooterViewDidMore];
    }
}

@end
